package com.dream.house.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import cn.com.servyou.base.exception.ServiceException;
import cn.com.servyou.utils.Page;

import com.dream.house.dao.BuildDAO;
import com.dream.house.entity.BuildDTO;

public class BuildService extends HouseBaseService{
	
	@Autowired
	private BuildDAO buildDAO;
	
	public boolean saveBuild(BuildDTO dto) throws ServiceException{
		dto.setBuild_id(buildDAO.getMaxId());
		return buildDAO.saveBuild(dto);
	}
	
	public boolean modifyBuild(BuildDTO dto) throws ServiceException{
		return buildDAO.updateBuild(dto);
	}
	
	public boolean removeBuild(String id) throws ServiceException{
		return buildDAO.removeBuild(id);
	}
	
	public List<BuildDTO> findBuilds(BuildDTO dto) throws ServiceException{
		return buildDAO.findBuilds(dto);
	}
	
	public Page findByPage(Map<String, Object> condition, int pageNo,
			int pageSize) throws ServiceException{
		
		return buildDAO.findByPage(condition, pageNo, pageSize);
	}
	
	public BuildDTO getBuild(String id) throws ServiceException{
		return buildDAO.getBuild(id);
	}
	
	/**
	 * 审核
	 * @param id
	 * @param status
	 * @param checkUser
	 * @return
	 * @throws ServiceException
	 */
	public boolean grant(String id,String status,String checkUser) throws ServiceException{
		return buildDAO.grant(id, status, checkUser,"1");
	}

	@Override
	public boolean check(Map<String, String> condition) throws ServiceException {
		// TODO Auto-generated method stub
		return false;
	}
}
